import java.util.*;

public class Main {

    public static int solution(String s) {
        // PLEASE DO NOT MODIFY THE FUNCTION SIGNATURE
        // write code here

        // Convert string to lowercase and count characters
        Map<Character, Integer> charDict = new HashMap<>();
        String lowerStr = s.toLowerCase();

        for (char c : lowerStr.toCharArray()) {
            charDict.put(c, charDict.getOrDefault(c, 0) + 1);
        }

        int kNum = charDict.getOrDefault('k', 0);
        int uNum = charDict.getOrDefault('u', 0);

        return Math.min(kNum, uNum);
    }

    public static void main(String[] args) {
        System.out.println(solution("AUBTMKAxfuu") == 1);
        System.out.println(solution("KKuuUuUuKKKKkkkkKK") == 6);
        System.out.println(solution("abcdefgh") == 0);
    }
}